<%@ page session="false" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://myfaces.apache.org/trinidad" prefix="tr"%>
<%@ taglib uri="http://myfaces.apache.org/trinidad/html" prefix="trh"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
	
<tr:panelGroupLayout rendered="#{orderBean.inserted}">
    <table width="100%">
        <tr>
            <td style="font-size:22px;text-align:center">
                <h:outputText value="Zamówienie nr #{orderBean.number}"/>
            </td>
        </tr>
    </table>
</tr:panelGroupLayout>

<tr:panelGroupLayout>
<fieldset>
<legend>
<tr:panelGroupLayout partialTriggers="type">
<tr:outputText value="#{orderBean.offer ? 'oferta' : 'zamówienie' }" />
	<tr:commandLink shortDesc="Drukuj zamówienie do PDF"
					action="#{orderController.printOrder}"
					rendered="#{orderBean.inserted}">
		<tr:image source="gfx/icon/print-icon.png" />
	</tr:commandLink>
</tr:panelGroupLayout>
</legend>

    <table width="100%" border="0" style="margin-bottom:10px">
        <tr>
            <td colspan="2" align="right">
            <tr:panelGroupLayout layout="vertical">
                <tr:selectOneChoice id="type" label="Rodzaj pozycji"  
                					value="#{orderBean.type}" autoSubmit="true" 
                					rendered="#{!orderBean.inserted}"
                					valueChangeListener="#{orderController.recordTypeChanged}">
                    <f:selectItems value="#{ConstantDictionaries.recordTypes}" />
                </tr:selectOneChoice>

                <tr:commandLink shortDesc="Przekształć do zamówienia"
                				rendered="#{orderBean.offer}" 
                				actionListener="#{orderController.makeOrderFromOffer}">
                <tr:image source="gfx/icon/offer-order.gif" />
                </tr:commandLink>
            </tr:panelGroupLayout>
            </td>
            <td colspan="2" align="right">
            <tr:panelGroupLayout layout="vertical">
                <tr:selectOneChoice value="#{orderBean.status}" label="Status" 
                					readOnly="#{SessionDataTO.readOnly}" 
                					valueChangeListener="#{orderController.statusChanged}">
                    <f:selectItems value="#{ConstantDictionaries.orderStatus}" />
                </tr:selectOneChoice>
            </tr:panelGroupLayout>
            </td>
            <td valign="top" align="right" rowspan="3">
            	<tr:panelGroupLayout layout="vertical">
                	<jsp:include page="attachment_upload.jsp" flush="true"/>
                </tr:panelGroupLayout>
            </td>
        </tr>
        <tr>
            <td align="right" colspan="2">
	            	<tr:panelGroupLayout layout="horizontal" partialTriggers="type">
	            		<tr:selectOneChoice id="orderType" value="#{orderBean.number}" partialTriggers="type"
	            							rendered="#{!orderBean.inserted}" label="Rodzaj zamówienia"
	            							binding="#{orderController.orderNumberBinding}"
	            							required="true">
	            			<f:selectItem itemLabel="--BRAK--"/>
	                    	<f:selectItems value="#{ConstantDictionaries.orderTypes}" />
	                	</tr:selectOneChoice>
	                </tr:panelGroupLayout>
            </td>
            <td colspan="2" align="right">
            	<tr:selectBooleanCheckbox value="#{orderBean.approvedBoolean}" label="Zatwierdzone" 
            							readOnly="#{SessionDataTO.readOnly}"
                						shortDesc="Zatwierdzono #{orderBean.approved}"/>
            </td>
        </tr>
        <tr>
        <td align="right">Towar zamówiono</td>
        <td>
        		<t:inputDate id="stuffOrdered" type="date" disabled="#{SessionDataTO.readOnly}"
                    		required="false" styleClass="input_text" 
                            value="#{orderBean.stuffOrdered}" popupCalendar="true"/>
                     <h:message for="stuffOrdered" styleClass="validation_info"/>
        </td>
        <td colspan="2" align="right">
        	<tr:panelGroupLayout layout="vertical" partialTriggers="additionalStatus">
        	    <tr:selectOneChoice value="#{orderBean.additionalStatus}"
        	    					readOnly="#{SessionDataTO.readOnly}"
        	    					label="Wpłata"
        	    					autoSubmit="true" id="additionalStatus"
        	    					valueChangeListener="#{orderController.additionalStatusChanged}">
                    <f:selectItems value="#{ConstantDictionaries.additionalStatus}" />
                </tr:selectOneChoice>
        	</tr:panelGroupLayout>
        
        </td>
        </tr>
        <tr>
            <td colspan="2" align="right">
                <tr:outputText shortDesc="Osoba, ktora wprowadziła zamówienie" 
                				value="Wprowadził #{orderBean.creatorName}" />
            </td>
            <td colspan="2" align="right">
                <tr:panelGroupLayout layout="horizontal">
                    <tr:selectOneChoice value="#{orderBean.responsible}" label="Odpowiedzialna"
                                    readOnly="true"
                                    shortDesc="Wybierz osobę odpowiedzialną za to zamówienie">
                    <f:selectItems value="#{salesmanController.salesmanItems}"/>
                </tr:selectOneChoice>
                    <tr:commandButton rendered="#{not SessionDataTO.readOnly}"
                    				  text="Przekaż" useWindow="false" blocking="true" id="passing"
                                      action="dialog:passing_form" windowHeight="150" windowWidth="250"
                                      returnListener="#{orderController.passingReturned}"
                                      inlineStyle="margin-left:8px;background-color:silver"/>
                </tr:panelGroupLayout>

            </td>
            <td valign="top" align="right" rowspan="4">
           		<tr:inputText columns="60" rows="5" label="Uwagi"
                			id="note" value="#{orderBean.note}" readOnly="#{SessionDataTO.readOnly}" 
                			shortDesc="Uwagi"/>
            </td>
        </tr>
        <tr>
            <td align="right">
                Data rejestracji
            </td>
            <td>
                <h:outputText id="registrationdate" value="#{orderBean.registrationdate}" title="Registrationdate" style="display:block">
                    <f:convertDateTime pattern="dd-MMMMM-yyyy HH:mm (EEEEE)" locale="pl"/>
                </h:outputText>
            </td>
            <td colspan="2" align="right">
                <tr:inputText maximumLength="10" id="prepayment" value="#{orderBean.prepayment}"
                			  readOnly="#{SessionDataTO.readOnly}" label="Zaliczka"
                              onkeypress="return checkField(window.self.event, NUMBER_FIELD)"
                              shortDesc="" required="false">
                    <f:convertNumber groupingUsed="false" maxFractionDigits="2" minFractionDigits="2" locale="pl"/>
                </tr:inputText>
            </td>
        </tr>

        <tr>
            <td align="right">
                Planowana data odbioru
            </td>
            <td>
            	<t:inputDate id="planDateOfReceiptInput" type="date"
                    		required="false" styleClass="input_text"
                    		disabled="#{orderBean.statusEnum=='ODEBRANE' || orderBean.statusEnum=='ANULOWANE' || SessionDataTO.readOnly}"
                            value="#{orderBean.dateOfReceipt}" popupCalendar="true" ampm="false"/>
                     <h:message for="planDateOfReceiptInput" styleClass="validation_info"/>
            </td>
            <td colspan="2" align="right">
                <tr:inputText value="#{orderBean.totalamount}" readOnly="true"
                				id="totalAmount" label="Suma zamówienia"  
                				shortDesc="Suma całkowita">
                    <f:convertNumber groupingUsed="false" maxFractionDigits="2" minFractionDigits="2" locale="pl"/>
                </tr:inputText>
            </td>
        </tr>
        <tr>
            <td colspan="2" align="right">
                <tr:inputText maximumLength="45" id="VATInvoice" value="#{orderBean.VATInvoice}" 
                			  label="Numer faktury zakupowej" 
                              shortDesc="Numer faktury VAT zakupowej" readOnly="#{SessionDataTO.readOnly}"
                              rendered="#{not empty orderBean.number}"/>
            </td>
            <td colspan="2" align="right">
                <tr:inputText id="restForPay" value="#{orderBean.restOfPayment}"
                               inlineStyle="font-weight:bold;font-size:14px" label="Pozostało do zapłaty"
                               shortDesc="Reszta po odliczeniu zaliczki">
                    <f:convertNumber groupingUsed="false" maxFractionDigits="2" minFractionDigits="2" locale="pl"/>
                </tr:inputText>
            </td>
        </tr>
        <tr>
            <td colspan="2" align="right">
                <tr:inputText id="preReceipt" readOnly="#{SessionDataTO.readOnly}"
                              value="#{orderBean.preReceipt}" label="Paragon zaliczkowy"
                               shortDesc="Paragon zaliczkowy musi być wpisany po wpłaceniu przez klienta zaliczki"
                               maximumLength="45" />
            </td>
            <td colspan="2" align="right">
                <tr:inputText id="shippingCost" value="#{orderBean.shippingCost}" readOnly="#{SessionDataTO.readOnly}"
                              shortDesc="Koszt ewentualnej przesyłki" label="Koszt przesyłki">
                    <f:convertNumber groupingUsed="false" maxFractionDigits="2" minFractionDigits="2" locale="pl"/>
                </tr:inputText>
            </td>
            <td valign="top" align="right" rowspan="4">
            		<tr:inputText columns="60" rows="5" readOnly="#{SessionDataTO.readOnly}" 
            				label="Potwierdzenie wpłaty" partialTriggers="additionalStatus"
                			id="paymentConfirmation" value="#{orderBean.paymentConfirmation}" autoSubmit="true"
                			shortDesc="Dokument potwierdzający wpłatę cześci lub całości"/>
            </td>
        </tr>
        <tr>
            <td colspan="2" align="right">
                <tr:inputText id="receipt" rendered="#{not empty orderBean.number}" label="Paragon"
                              value="#{orderBean.receipt}" readOnly="#{SessionDataTO.readOnly}"
                              shortDesc="Paragon z kasy fiskalnej wpisany po zaksiegowaniu w systemie informatycznym"
                              maximumLength="45"/>
            </td>
            <td colspan="2" align="right">
                <tr:inputText id="otherCost" value="#{orderBean.otherCost}" readOnly="#{SessionDataTO.readOnly}"
                              shortDesc="Inne koszty" label="Inne koszty">
                    <f:convertNumber groupingUsed="false" maxFractionDigits="2" minFractionDigits="2" locale="pl"/>
                </tr:inputText>
            </td>
        </tr>
        <tr>
            <td colspan="2" align="right">
                <tr:inputText id="contactPhone1" value="#{orderBean.contactPhone}" label="Telefon kontaktowy"
                              required="true" readOnly="#{SessionDataTO.readOnly}"
                              shortDesc="Telefon kontaktowy do osoby, odpowiedzialnej za zamówienie"/>
            </td>
            <td colspan="2" align="right">
            <tr:panelGroupLayout layout="horizontal">
                    <tr:inputText id="shippingNo" value="#{orderBean.shippingNo}" label="Numer przesyłki" 
                                  contentStyle="text-align:right;width:80%" inlineStyle="text-align:right" readOnly="#{SessionDataTO.readOnly}"
                                  shortDesc="Numer przesyłki" maximumLength="45"/>

                    <tr:commandButton shortDesc="Wyślij informację do klienta" icon="gfx/email-icon.png"
                                      actionListener="#{orderController.sendEmailToClient}"
                                      disabled="#{SessionDataTO.readOnly}"
                                      inlineStyle="margin-left:5px;border:none;cursor:pointer"/>
            </tr:panelGroupLayout>
            </td>
        </tr>
        <tr>
            <td colspan="2" align="right">
                <tr:inputText id="email" value="#{orderBean.email}" label="email" 
                				readOnly="#{SessionDataTO.readOnly}" maximumLength="150"
                              	contentStyle="width:100%">
                    <f:validator validatorId="EmailValidator"/>
                </tr:inputText>
            </td>
            <td valign="top" align="right" colspan="2">
                <tr:inputText id="clientName" required="true" readOnly="#{SessionDataTO.readOnly}"
                              value="#{orderBean.clientName}" maximumLength="100" label="Osoba zamawiająca"
                             shortDesc="Imię i nazwisko osoby zamawiającej" inlineStyle="width:100%;display:block"/>
            </td>
        </tr>
        <tr>
            <td align="right" valign="top">

            </td>
            <td colspan="2" align="left">

            </td>
            <td align="right" valign="top">

            </td>
            <td align="right">
                <tr:inputText columns="60" rows="5" label="Adres wysyłki"
                				value="#{orderBean.shippingAddress}" readOnly="#{SessionDataTO.readOnly}"
                				shortDesc="shippingAddress"/>
            </td>
        </tr>
    </table>
    
    <tr:panelGroupLayout rendered="#{not empty orderBean.number}">
	<!-- Navbar or list -->
	<tr:navigationPane hint="buttons" rendered="#{not SessionDataTO.readOnly}">
			<tr:commandNavigationItem text="Dodaj zaproszenie" action="#{orderController.newInvitationItem}" immediate="true" />
			<tr:commandNavigationItem text="Dodaj winietkę" action="#{orderController.newVignetteItem}" immediate="true" />
			<tr:commandNavigationItem text="Dodaj wkładkę" action="#{orderController.newInsertionItem}" immediate="true" />
			<tr:commandNavigationItem text="Dodaj inny product" action="#{orderController.newProductItem}" immediate="true" />
	</tr:navigationPane>
	</tr:panelGroupLayout>
    
            
</fieldset>

<tr:panelGroupLayout rendered="#{not empty orderBean.invitationEntityCollection}">
<fieldset><legend>Zaproszenia</legend>
    <t:dataTable id="orderFormtextDataList" headerClass="table-header"
                 rowOnMouseOver="this.style.backgroundColor='#e0ffc2'" rowOnMouseOut="this.style.backgroundColor='#FFF'"
                binding="#{orderController.invitationListDataTable}" width="100%"
                value="#{orderBean.invitationEntityCollection}"
                var="invitation" rows="0" renderedIfEmpty="false">
        <t:column>
            <f:facet name="header">
                <h:outputText value="Kod pozycji" />
            </f:facet>
            <h:outputText id="type" value="#{invitation.code}" />
        </t:column>
        <t:column>
            <f:facet name="header">
                <h:outputText value="Cena za szt."/>
            </f:facet>
            <h:outputText value="#{invitation.unitprice}">
                <f:convertNumber groupingUsed="false" maxFractionDigits="2" minFractionDigits="2" locale="pl"/>
            </h:outputText>
        </t:column>
        <t:column>
            <f:facet name="header">
                <h:outputText value="Ilość" title="Całkowita ilość zaproszeń"/>
            </f:facet>
            <h:outputText value="#{invitation.totalCount}"/>
        </t:column>
        <t:column>
            <f:facet name="header">
                <h:outputText value="Razem" />
            </f:facet>
            <h:outputText value="#{invitation.unitprice * invitation.totalCount}">
            	<f:convertNumber groupingUsed="false" maxFractionDigits="2" minFractionDigits="2" locale="pl"/>
            </h:outputText>
        </t:column>
        <t:column width="25%">
            <f:facet name="header">
                <h:outputText value="Kalkulacja" />
            </f:facet>
            <tr:outputFormatted value="#{invitation.calculatingNote}">
            	<f:converter converterId="FormatedTextConverter" />
           	</tr:outputFormatted>
        </t:column>
        <t:column width="25%">
            <f:facet name="header">
                <h:outputText value="Uwagi" />
            </f:facet>
            <h:outputText value="#{invitation.note}"/>
        </t:column>
        <t:column style="width:25px" rendered="#{not SessionDataTO.readOnly}">
            <f:facet name="header">
                <h:outputText value="Edytuj"/>
            </f:facet>
            <tr:commandLink inlineStyle="margin-right:10px"
                            shortDesc="Edytuj tę pozycję"
                            action="#{orderController.editInvitationInOrder}">
                <tr:image source="gfx/edit.png" />
            </tr:commandLink>
        </t:column>
        <t:column style="width:30px" rendered="#{not SessionDataTO.readOnly}">
            <f:facet name="header">
                <h:outputText value="Usuń"/>
            </f:facet>
            <tr:commandLink shortDesc="Usuń tę pozycję z zamówienia"
            				onclick="return confirmMessageBox('Czy chcesz usunąć pozycję o kodzie: #{invitation.code} dla państwa: #{invitation.bridename} i #{invitation.bridegroom}?');"
                             action="#{orderController.removeInvitationFromOrder}">
                <tr:image source="gfx/delete.png" />
            </tr:commandLink>
        </t:column>
    </t:dataTable>
</fieldset>
</tr:panelGroupLayout>

<tr:panelGroupLayout rendered="#{not empty orderBean.vignietteCollection}">
<fieldset><legend>Winietki</legend>
    <t:dataTable id="vignietteDataList" headerClass="table-header"
                 rowOnMouseOver="this.style.backgroundColor='#e0ffc2'" rowOnMouseOut="this.style.backgroundColor='#FFF'"
                 binding="#{orderController.vignietteListDataTable}" width="100%" value="#{orderBean.vignietteCollection}"
                var="vigniette" rows="0" renderedIfEmpty="false">
    <t:column>
        <f:facet name="header" >
            <h:outputText value="Kod"/>
        </f:facet>
        <h:outputText value="#{vigniette.code}"/>
    </t:column>

        <t:column>
            <f:facet name="header">
                <h:outputText value="Cena za szt." />
            </f:facet>
            <h:outputText id="type" value="#{vigniette.unitprice}" >
                <f:convertNumber groupingUsed="false" maxFractionDigits="2" minFractionDigits="2" locale="pl"/>
            </h:outputText>
        </t:column>
      <t:column>
        <f:facet name="header">
            <h:outputText value="Ilość" />
        </f:facet>
        	<h:outputText value="#{vigniette.totalcount}"/>
    	</t:column>
    	<t:column>
        <f:facet name="header">
            <h:outputText value="Razem" />
        </f:facet>
        	<h:outputText value="#{vigniette.totalcount * vigniette.unitprice}">
        		<f:convertNumber groupingUsed="false" maxFractionDigits="2" minFractionDigits="2" locale="pl"/>
        	</h:outputText>
    	</t:column>
    	<t:column width="25%">
            <f:facet name="header">
                <h:outputText value="Kalkulacja" />
            </f:facet>
            <tr:outputFormatted value="#{vigniette.calculatingNote}">
            	<f:converter converterId="FormatedTextConverter" />
           	</tr:outputFormatted>
        </t:column>
        <t:column width="25%">
            <f:facet name="header">
                <h:outputText value="Uwagi" />
            </f:facet>
            <h:outputText value="#{vigniette.note}"/>
        </t:column>
        <t:column style="width:25px" rendered="#{not SessionDataTO.readOnly}">
            <f:facet name="header">
                <h:outputText value="Edytuj"/>
            </f:facet>
            <tr:commandLink inlineStyle="margin-right:10px"
            				shortDesc="Edytuj tę pozycję" action="#{orderController.editVignietteInOrder}">
                <tr:image source="gfx/edit.png" />
            </tr:commandLink>
        </t:column>
        <t:column style="width:30px" rendered="#{not SessionDataTO.readOnly}">
            <f:facet name="header">
                <h:outputText value="Usuń"/>
            </f:facet>
            <tr:commandLink shortDesc="Usuń tę pozycję z zamówienia"
            				onclick="return confirmMessageBox('Czy chcesz usunąć pozycję o kodzie: #{vigniette.code}?');"
                             action="#{orderController.removeVignietteFromOrder}">
                <tr:image source="gfx/delete.png" />
            </tr:commandLink>
        </t:column>
    </t:dataTable>
</fieldset>
</tr:panelGroupLayout>

<tr:panelGroupLayout rendered="#{not empty orderBean.insertionCollection}">
<fieldset><legend>Wkładki</legend>
    <t:dataTable id="insertionDataList" headerClass="table-header" 
                 rowOnMouseOver="this.style.backgroundColor='#e0ffc2'" rowOnMouseOut="this.style.backgroundColor='#FFF'"
                 binding="#{orderController.insertionListDataTable}" width="100%" value="#{orderBean.insertionCollection}"
                var="insertion" rows="0" renderedIfEmpty="false">
    <t:column>
        <f:facet name="header" >
            <h:outputText value="Kod"/>
        </f:facet>
        <h:outputText value="#{insertion.code}"/>
    </t:column>
        <t:column>
            <f:facet name="header">
                <h:outputText value="Cena za szt." />
            </f:facet>
            <h:outputText value="#{insertion.unitprice}" >
                <f:convertNumber groupingUsed="false" maxFractionDigits="2" minFractionDigits="2" locale="pl"/>
            </h:outputText>
        </t:column>
       <t:column>
        <f:facet name="header">
            <h:outputText value="Ilość" />
        </f:facet>
        <h:outputText value="#{insertion.totalcount}"/>
    	</t:column>
        <t:column>
        <f:facet name="header">
            <h:outputText value="Razem" />
        </f:facet>
        	<h:outputText value="#{insertion.unitprice * insertion.totalcount}">
        		<f:convertNumber groupingUsed="false" maxFractionDigits="2" minFractionDigits="2" locale="pl"/>
        	</h:outputText>
    	</t:column>
    	<t:column width="25%">
            <f:facet name="header">
                <h:outputText value="Kalkulacja" />
            </f:facet>
            <tr:outputFormatted value="#{insertion.calculatingNote}">
            	<f:converter converterId="FormatedTextConverter" />
           	</tr:outputFormatted>
        </t:column>
        <t:column width="25%">
            <f:facet name="header">
                <h:outputText value="Uwagi" />
            </f:facet>
            <h:outputText value="#{insertion.note}"/>
        </t:column>
        <t:column style="width:25px" rendered="#{not SessionDataTO.readOnly}">
            <f:facet name="header">
                <h:outputText value="Edytuj"/>
            </f:facet>
            <tr:commandLink inlineStyle="margin-right:10px"
            				shortDesc="Edytuj tę pozycję" 
            				action="#{orderController.editInsertionInOrder}">
                <tr:image source="gfx/edit.png" />
            </tr:commandLink>
        </t:column>
        <t:column style="width:30px" rendered="#{not SessionDataTO.readOnly}">
            <f:facet name="header">
                <h:outputText value="Usuń"/>
            </f:facet>
            <tr:commandLink shortDesc="Usuń tę pozycję z zamówienia"
            				onclick="return confirmMessageBox('Czy chcesz usunąć pozycję o kodzie: #{insertion.code} ?');"
                             action="#{orderController.removeInsertionFromOrder}">
                <tr:image source="gfx/delete.png" />
            </tr:commandLink>
        </t:column>
    </t:dataTable>
</fieldset>
</tr:panelGroupLayout>

<tr:panelGroupLayout rendered="#{not empty orderBean.productCollection}">
<fieldset><legend>Artykuły</legend>
    <t:dataTable id="productDataList" headerClass="table-header"
                 rowOnMouseOver="this.style.backgroundColor='#e0ffc2'" rowOnMouseOut="this.style.backgroundColor='#FFF'"
                 binding="#{orderController.productListDataTable}" width="100%" value="#{orderBean.productCollection}"
                var="product" rows="0" renderedIfEmpty="false">
    <t:column>
        <f:facet name="header" >
            <h:outputText value="Kod"/>
        </f:facet>
        <h:outputText value="#{product.code}"/>
    </t:column>
        <t:column>
            <f:facet name="header">
                <h:outputText value="Cena za szt." />
            </f:facet>
            <h:outputText value="#{product.unitPrice}" >
                <f:convertNumber groupingUsed="false" maxFractionDigits="2" minFractionDigits="2" locale="pl"/>
            </h:outputText>
        </t:column>
        <t:column>
        <f:facet name="header">
            <h:outputText value="Ilość" />
        </f:facet>
        <h:outputText value="#{product.totalCount}"/>
    	</t:column>
        <t:column>
        <f:facet name="header">
            <h:outputText value="Razem" />
        </f:facet>
        	<h:outputText value="#{product.unitPrice * product.totalCount}">
        		<f:convertNumber groupingUsed="false" maxFractionDigits="2" minFractionDigits="2" locale="pl"/>
        	</h:outputText>
    	</t:column>
    	<t:column width="25%">
            <f:facet name="header">
                <h:outputText value="Kalkulacja" />
            </f:facet>
            <tr:outputFormatted value="#{product.calculatingNote}">
            	<f:converter converterId="FormatedTextConverter" />
           	</tr:outputFormatted>
        </t:column>
        <t:column width="25%">
            <f:facet name="header">
                <h:outputText value="Uwagi" />
            </f:facet>
            <h:outputText value="#{product.note}"/>
        </t:column>
        <t:column style="width:25px" rendered="#{not SessionDataTO.readOnly}">
            <f:facet name="header">
                <h:outputText value="Edytuj"/>
            </f:facet>
            <tr:commandLink inlineStyle="margin-right:10px" 
            				shortDesc="Edytuj tę pozycję" 
            				action="#{orderController.editProductInOrder}">
                <tr:image source="gfx/edit.png" />
            </tr:commandLink>
        </t:column>
        <t:column style="width:30px" rendered="#{not SessionDataTO.readOnly}">
            <f:facet name="header">
                <h:outputText value="Usuń"/>
            </f:facet>
            <tr:commandLink shortDesc="Usuń tę pozycję z zamówienia"
            				onclick="return confirmMessageBox('Czy chcesz usunąć pozycję o kodzie: #{product.code}?');"
                             action="#{orderController.removeProductFromOrder}">
                <tr:image source="gfx/delete.png" />
            </tr:commandLink>
        </t:column>
    </t:dataTable>
</fieldset>
</tr:panelGroupLayout>

<jsp:include page="/comment_list.jsp" flush="true" />

<table cellspacing="2" cellpadding="0" width="100%">
    <tr>
        <td>
        </td>
        <td>
        </td>
        <td>
        </td>
        <td align="right">
            <tr:commandButton text="Podsumowanie" rendered="#{not SessionDataTO.readOnly}" 
            					action="#{orderController.orderPreview}" 
            					inlineStyle="background-color:green;color:white"/>
        </td>
    </tr>
</table>

</tr:panelGroupLayout>
